{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "from numpy import genfromtxt\n",
    "from sklearn import linear_model\n",
    "import matplotlib.pyplot as plt\n",
    "%matplotlib inline"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[      nan       nan       nan       nan       nan       nan       nan\n",
      "        nan]\n",
      " [      nan    83.      234.289   235.6     159.      107.608  1947.\n",
      "     60.323]\n",
      " [      nan    88.5     259.426   232.5     145.6     108.632  1948.\n",
      "     61.122]\n",
      " [      nan    88.2     258.054   368.2     161.6     109.773  1949.\n",
      "     60.171]\n",
      " [      nan    89.5     284.599   335.1     165.      110.929  1950.\n",
      "     61.187]\n",
      " [      nan    96.2     328.975   209.9     309.9     112.075  1951.\n",
      "     63.221]\n",
      " [      nan    98.1     346.999   193.2     359.4     113.27   1952.\n",
      "     63.639]\n",
      " [      nan    99.      365.385   187.      354.7     115.094  1953.\n",
      "     64.989]\n",
      " [      nan   100.      363.112   357.8     335.      116.219  1954.\n",
      "     63.761]\n",
      " [      nan   101.2     397.469   290.4     304.8     117.388  1955.\n",
      "     66.019]\n",
      " [      nan   104.6     419.18    282.2     285.7     118.734  1956.\n",
      "     67.857]\n",
      " [      nan   108.4     442.769   293.6     279.8     120.445  1957.\n",
      "     68.169]\n",
      " [      nan   110.8     444.546   468.1     263.7     121.95   1958.\n",
      "     66.513]\n",
      " [      nan   112.6     482.704   381.3     255.2     123.366  1959.\n",
      "     68.655]\n",
      " [      nan   114.2     502.601   393.1     251.4     125.368  1960.\n",
      "     69.564]\n",
      " [      nan   115.7     518.173   480.6     257.2     127.852  1961.\n",
      "     69.331]\n",
      " [      nan   116.9     554.894   400.7     282.7     130.081  1962.\n",
      "     70.551]]\n"
     ]
    }
   ],
   "source": [
    "data = np.genfromtxt(r'longley.csv',delimiter=',')\n",
    "print(data)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[  234.289   235.6     159.      107.608  1947.       60.323]\n",
      " [  259.426   232.5     145.6     108.632  1948.       61.122]\n",
      " [  258.054   368.2     161.6     109.773  1949.       60.171]\n",
      " [  284.599   335.1     165.      110.929  1950.       61.187]\n",
      " [  328.975   209.9     309.9     112.075  1951.       63.221]\n",
      " [  346.999   193.2     359.4     113.27   1952.       63.639]\n",
      " [  365.385   187.      354.7     115.094  1953.       64.989]\n",
      " [  363.112   357.8     335.      116.219  1954.       63.761]\n",
      " [  397.469   290.4     304.8     117.388  1955.       66.019]\n",
      " [  419.18    282.2     285.7     118.734  1956.       67.857]\n",
      " [  442.769   293.6     279.8     120.445  1957.       68.169]\n",
      " [  444.546   468.1     263.7     121.95   1958.       66.513]\n",
      " [  482.704   381.3     255.2     123.366  1959.       68.655]\n",
      " [  502.601   393.1     251.4     125.368  1960.       69.564]\n",
      " [  518.173   480.6     257.2     127.852  1961.       69.331]\n",
      " [  554.894   400.7     282.7     130.081  1962.       70.551]]\n",
      "[  83.    88.5   88.2   89.5   96.2   98.1   99.   100.   101.2  104.6\n",
      "  108.4  110.8  112.6  114.2  115.7  116.9]\n"
     ]
    }
   ],
   "source": [
    "#切分数据\n",
    "x_data = data[1:,2:]\n",
    "y_data = data[1:,1]\n",
    "print(x_data)\n",
    "print(y_data)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0.360853388534\n",
      "(16, 100000)\n"
     ]
    }
   ],
   "source": [
    "#创建模型，生成50个值\n",
    "alphas_to_test = np.linspace(0.001,1,100000) #默认生成从0.001到1 的50个数  要生成100个数可写成（0.001，1，100）\n",
    "model = linear_model.RidgeCV(alphas = alphas_to_test,store_cv_values = True)\n",
    "model.fit(x_data,y_data)\n",
    "\n",
    "#岭系数\n",
    "print(model.alpha_)\n",
    "#loss值\n",
    "print(model.cv_values_.shape)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([ 115.41980612])"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "model.predict(x_data[-2,np.newaxis])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAX8AAAEACAYAAABbMHZzAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3XuQVOW57/Hvw2W4CkQ0KhCuiqiAikEFibaiggbUxHJH\nIRdNUjv7nOxEY9zHJFUexnJ7EreaxGiSXSQTIjHoVrFEiAiodAiIimGQO6gg6CBjUC4BRRh5zh9v\nj9Pg9HTPTHevvvw+Vaumu9fqtZ5ZNfP02+/V3B0RESkvbaIOQERE8k/JX0SkDCn5i4iUISV/EZEy\npOQvIlKGlPxFRMpQ2uRvZlVmVmtmK1Psv8XMqs1suZmtMrM6M+uR2PcDM1ttZivN7M9mVpHtX0BE\nRJrP0vXzN7MxwF5gursPT3PsBOAmd7/YzHoBi4Eh7n7AzP4H+Iu7T89S7CIi0kJpS/7uvhjYmeH5\nrgMeTnreFuhiZu2AzsC2ZkcoIiJZl7U6fzPrBIwHZgK4+zbgXmArUAPscvdns3U9ERFpuWw2+E4E\nFrv7LoBEvf+VQD+gF9DVzCZl8XoiItJC7bJ4rms5vMrnYmCTu78PYGZPAKOBGY292cw0yZCISDO5\nu7XkfZmW/C2xNb7TrDtwATAr6eWtwLlm1tHMDBgLrGvqIu6uzZ0pU6ZEHkMhbLoPuhe6F01vrZG2\n5G9mM4AY0NPMtgJT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HlUyb3ArgNOBr4TaLEe9Ddz44u6tzI8F4c\n9pa8B5knGf6PpBxUWUoy/Lv4T+CPSd0f/4+7vx9RyDmVwWDbZudODfISESlDeR3kJSIihUHJX0Sk\nDCn5i4iUISV/EZEypOQvIlKGlPxFRMqQkr+ISBlS8hcRKUP/HxL5Moq0FbizAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x1ca62e0e320>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "#画图\n",
    "plt.plot(alphas_to_test,model.cv_values_.mean(axis = 0))\n",
    "plt.plot(model.alpha_,min(model.cv_values_.mean(axis = 0)),'ro')\n",
    "plt.show()\n"
   ]
  }
 ],
 "metadata": {
  "anaconda-cloud": {},
  "kernelspec": {
   "display_name": "Python [Root]",
   "language": "python",
   "name": "Python [Root]"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.5.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
